package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseDomain;
import cn.itsource.basic.domain.CreatePassword;
import cn.itsource.basic.util.PetConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 部门实体类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_user")
public class User extends BaseDomain implements CreatePassword {
    /**
     * 规则解耦
     * @RequestBody @Validated(User.PhoneRegister.class) User user
     */
    public interface PhoneRegister{};
    public interface EmailRegister{};
    private String username;
    @NotBlank(message ="邮箱为空",groups ={EmailRegister.class} )
    private String email;
    @NotBlank(message = "手机号为空",groups = {PhoneRegister.class})
    private String phone;
    private String salt;
    @NotBlank(message = "密码为空",groups = {PhoneRegister.class,EmailRegister.class})
    @Size(min=3,message = "密码最少3位",groups = {PhoneRegister.class,EmailRegister.class})
    private String password;
    private Double count;
    private Integer age;
    private Date createtime=new Date();
    private String headImg;

    @Transient
    private String configPassword;
    @Transient
    private String code;
}
